<template>
  <a-card :loading="cardLoading" :bordered="false" style="height: 100%;">
      <a-radio-group v-model="value" @change="onChange">
        <a-radio :style="radioStyle" :value="1">
          非空校验
        </a-radio>
        <a-radio :style="radioStyle" :value="2">
          唯一校验
        </a-radio>
        <a-radio :style="radioStyle" :value="3">
          比较性校验
        </a-radio>
        <a-radio :style="radioStyle" :value="4">
          一致性校验
        </a-radio>
        <a-radio :style="radioStyle" :value="5">
          业务逻辑校验
        </a-radio>
        <a-radio :style="radioStyle" :value="6">
          关联校验
        </a-radio>
        <a-radio :style="radioStyle" :value="7">
          特殊编码规则校验
        </a-radio>
        <a-radio :style="radioStyle" :value="8">
          范围/码值校验
        </a-radio>
        <!--<a-radio :style="radioStyle" :value="4">
          More...
          <a-input v-if="value === 4" :style="{ width: 100, marginLeft: 10 }" />
        </a-radio>-->
      </a-radio-group>
  </a-card>
</template>
<script>
  export default {
    name: 'RuleType',
    data() {
      return {
        value: '',
        cardLoading: false,
        loading: false,
        radioStyle: {
          display: 'block',
          height: '30px',
          lineHeight: '30px',
        },
      };
    },
    methods: {
      clear(){
        this.value = '';
        this.$emit('event1', this.value)
      },
      onChange(e) {
        if(this.$parent.$parent.$parent.tableName == "" || this.$parent.$parent.$parent.tableName == undefined||
          this.$parent.$parent.$parent.columnName == "" || this.$parent.$parent.$parent.columnName == undefined){
          this.value = '';
          this.$emit('event1', this.value)
          this.$message.warning('请选择表字段！');
          this.loading = false
          this.cardLoading = false
        }else{
          /* console.log('radio checked', e.target.value);*/
          this.value = e.target.value
          this.$emit('event1', this.value)
          this.loading = false
          this.cardLoading = false
        }

      },
    },
  };
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>